#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

#include <stdlib.h>

int* plusOne(int* digits, int digitsSize, int* returnSize) {
    int* new_digits = (int*)malloc((digitsSize + 1) * sizeof(int));

    int carry = 1;

    for (int i = digitsSize - 1; i >= 0; i--) {
        int sum = digits[i] + carry;
        new_digits[i + 1] = sum % 10; 
        carry = sum / 10; 
    }

    new_digits[0] = carry;

    *returnSize = (carry == 0) ? digitsSize : digitsSize + 1;

    return (carry == 0) ? new_digits + 1 : new_digits;
}


int main()
{
	return 0;
}